package com.castday2.castday2.bean.vo;

import com.castday2.castday2.bean.enums.CodeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @Author : 徐闯 mpcast
 * @Date : 2021-05-26 16:05:55
 * @Description :
 **/
@Data
@Accessors( chain = true)
@AllArgsConstructor
public class Result<T>{
    private Enum INFO;
    //状态码
    //private Integer code;
    //是否成功的标识
    //private Boolean success;
    //返回给前端的描述性消息
    //private String message;
    //模型数据
    private T data;
    // 提取冗余代码  二次封装
    public static Result ok(Object o){
        System.out.println(CodeEnum.OK);
        return new Result(CodeEnum.OK,o);
        //return new Result(OK,true,"成功",o);
        /* return new Result().setCode(200)
                .setData(o)
                .setMessage("成功")
                .setSuccess(true);*/
    }
    public static Result error(){
        return new Result(CodeEnum.ERROR,null);
        //return new Result(500,false,"失败",null);
        /* return new Result().setCode(500)
                .setData(null)
                .setMessage("失败")
                .setSuccess(false);*/
    }
}
